<template>
	<view class="content">
		<!-- <hx-navbar
			title="新疆 · 加油!" 
			:fixed="true"
			bar-placeholder="hidden"
			transparent="hidden"
			color="#ffffff"/> -->
		<view class="status_bar"></view>
		<view class="nav">我的</view>
		<view class="header">
			<image class="bgc" src="../../static/header.png" mode=""></image>
			<view class="info-c">
				<view class="info">
					<image class="" :src="user.avatar" mode=""></image>
					<view v-if="user.token" class="right">
						<view>{{ user.nickname }}</view>
						<view class="phone">{{ user.mobile }}</view>
					</view>
					<view v-else class="right" @click="navTo('/pages/enter/login')"><view>登录</view></view>
				</view>
			</view>
		</view>
		<view class="container">
			<view class="container-c">
				<!-- 用户端 -->
				<view class="order" v-if="user.level != '服务人员'">
					<view class="title">我的申报单</view>
					<view class="bottom">
						<view class="item" @tap="navTo('/pages/componentB/order/order?index=0&title=待指派')">
							<image src="../../static/wei.png" mode=""></image>
							<view>待指派</view>
						</view>
						<view class="item" @tap="navTo('/pages/componentB/order/order?index=1&title=待接受')">
							<image src="../../static/wei.png" mode=""></image>
							<view>待接受</view>
						</view>
						<view class="item" @tap="navTo('/pages/componentB/order/order?index=2&title=进行中')">
							<image src="../../static/jin.png" mode=""></image>
							<view>进行中</view>
						</view>
						<view class="item" @tap="navTo('/pages/componentB/order/order?index=3&title=等待确认')">
							<image src="../../static/yi.png" mode=""></image>
							<view>等待确认</view>
						</view>
						<view class="item" @tap="navTo('/pages/componentB/order/order?index=4&title=已完成')">
							<image src="../../static/yi.png" mode=""></image>
							<view>已完成</view>
						</view>
					</view>
				</view>
				<!-- 服务人员端 -->
				<view class="order" v-if="user.level == '服务人员'">
					<view class="title">我的申报单</view>
					<view class="bottom">
						<view class="item" @tap="navTo('/pages/componentB/service/service?index=0&title=未分配')">
							<image src="../../static/wei.png" mode=""></image>
							<view>待接收</view>
						</view>
						<view class="item" @tap="navTo('/pages/componentB/service/service?index=1&title=进行中')">
							<image src="../../static/jin.png" mode=""></image>
							<view>进行中</view>
						</view>
						<view class="item" @tap="navTo('/pages/componentB/service/service?index=2&title=已完成')">
							<image src="../../static/yi.png" mode=""></image>
							<view>已完成</view>
						</view>
					</view>
				</view>
				<view class="group">
					<view class="colmun" @tap="navTo('/pages/componentB/wallet/wallet')">
						<image class="img" src="../../static/pay2.png" mode=""></image>
						<view>
							<text>钱包</text>
							<image class="right" src="../../static/right.png" mode=""></image>
						</view>
					</view>
					<view class="" v-if="black == true" @tap="navTo('/pages/componentB/xiang/xiang')">
						<view v-if="user.level == '乡负责人'" class="colmun">
							<image class="img" src="../../static/col8.png" mode=""></image>
							<view>
								<text>村负责人</text>
								<image class="right" src="../../static/right.png" mode=""></image>
							</view>
						</view>
					</view>
					<view class="" v-if="black == true" @tap="navTo('/pages/componentB/nonghu/nonghu')">
						<view v-if="user.level == '村负责人'" class="colmun">
							<image class="img" src="../../static/col0.png" mode=""></image>
							<view>
								<text v-if="black == true">农户</text>
								<!-- <text v-else="black == false">(已在黑名单)禁止查看农户</text>
							<image class="right" src="../../static/right.png" mode=""></image> -->
							</view>
						</view>
					</view>
					<view class="colmun" @tap="navTo('/pages/componentB/msg/msg')">
						<image class="img" src="../../static/col33.png" mode=""></image>
						<view>
							<text>消息</text>
							<image class="right" src="../../static/right.png" mode=""></image>
						</view>
					</view>
				<!-- 	<view class="colmun" @tap="navTo('/pages/componentB/info/info')">
						<image class="img" src="../../static/col4.png" mode=""></image>
						<view>
							<text>个人信息编辑</text>
							<image class="right" src="../../static/right.png" mode=""></image>
						</view>
					</view> -->
					<view class="" v-if="black == true" @tap="navTo('/pages/me/outearth/outearth')">
						<view v-if="user.level == '普通用户'" class="colmun">
							<image class="img" src="../../static/tudi.png" mode=""></image>
							<view>
								<text>出租土地</text>
								<!-- <text v-else="black == false">(已在黑名单)禁用出租土地功能</text>
							<image class="right" src="../../static/right.png" mode=""></image> -->
							</view>
						</view>
					</view>
					<view class="" v-if="black == true"@tap="navTo('/pages/componentA/villageList/villageList')">
						<view v-if="user.level == '承包农户'" class="colmun">
							<image class="img" src="../../static/tudi.png" mode=""></image>
							<view>
								<!-- v-if="black==true" @tap="navTo('/pages/me/inearth/inearth')"  -->
								<!-- v-else="black==false" -->
								<text>土地列表</text>
								
								<!-- 	<text>(已在黑名单)禁用土地承包功能</text> -->
								<image class="right" src="../../static/right.png" mode=""></image>
							</view>
						</view>
					</view>
					<view class="" v-if="black == true"@tap="navTo('/pages/componentA/villageList/my_village')">
						<view v-if="user.level == '承包农户'" class="colmun">
							<image class="img" src="../../static/tudi.png" mode=""></image>
							<view>
								<!-- v-if="black==true" @tap="navTo('/pages/me/inearth/inearth')"  -->
								<!-- v-else="black==false" -->
								<text>我的承包</text>
								
								<!-- 	<text>(已在黑名单)禁用土地承包功能</text> -->
								<image class="right" src="../../static/right.png" mode=""></image>
							</view>
						</view>
					</view>
					<!-- 客户端投诉 -->
					<view class="colmun" @tap="navTo('/pages/componentB/complain/complain')">
						<image class="img" src="../../static/col6.png" mode=""></image>
						<view>
							<text>投诉</text>
							<image class="right" src="../../static/right.png" mode=""></image>
						</view>
					</view>
					<!-- 乡负责端投诉收集 -->
					<!-- <view v-if="user.level == '乡负责人'" class="colmun" @tap="navTo('/pages/componentB/tousuCollect/tousuCollect')">
						<image class="img" src="../../static/col6.png" mode=""></image>
						<view>
							<text>投诉</text>
							<image class="right" src="../../static/right.png" mode=""></image>
						</view>
					</view> -->
					<view class="colmun" @tap="navTo('/pages/componentB/feed/feed')">
						<image class="img" src="../../static/col5.png" mode=""></image>
						<view>
							<text>意见反馈</text>
							<image class="right" src="../../static/right.png" mode=""></image>
						</view>
					</view>
					<view class="colmun" @tap="navTo('/pages/componentB/about/about?title=关于我们')">
						<image class="img" src="../../static/col3.png" mode=""></image>
						<view>
							<text>关于我们</text>
							<image class="right" src="../../static/right.png" mode=""></image>
						</view>
					</view>
					<view class="colmun" @tap="navTo('/pages/componentB/set/set')">
						<image class="img" src="../../static/col7.png" mode=""></image>
						<view>
							<text>设置</text>
							<image class="right" src="../../static/right.png" mode=""></image>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="tip">
			<tex>Copyright © 2020-2022</tex>
			<tex>深圳市小春科技有限公司 版权所有</tex>
		</view>
	</view>
</template>

<script>
import hxNavbar from '@/components/hx-navbar/hx-navbar.vue';
import { mapState } from 'vuex';
export default {
	components: {
		hxNavbar
	},
	data() {
		return {
			type: 1,
			showdata: false,
			black: true
		};
	},
	computed: {
		...mapState({
			user: state => state.user //个人用户信息
		})
	},
	onLoad() {
		// console.log(this.$store.state.user);
		if (this.$store.state.user.level == 0) {
			this.showdata = true;
		} else {
			this.showdata = false;
		}
		this.getUserInfo();
	},

	methods: {
		//获取个人信息
		async getUserInfo() {
			let token = uni.getStorageSync('token');
			if (token && this.user.token == '') {
				let res = await this.$http.post('/api/user/userinfo').then(res => {
					if (res.data.data.userinfo.isblacklist == 1) {
						this.black = false;
					}
					this.$store.commit('SAVE_USER', res.data.data.userinfo);
				});

				
			}
		},
		navTo(url) {
			if (!uni.getStorageSync('token')) {
				uni.navigateTo({
					url: '/pages/enter/login'
				});
				return;
			}
			uni.navigateTo({
				url
			});
		}
	}
};
</script>

<style lang="less" scoped>
.content {
	width: 100%;
	min-height: 100vh;
	background: rgba(1, 87, 26, 0.08);
}
.nav {
	position: fixed;
	top: var(--status-bar-height);
	left: 30rpx;
	height: 44rpx;
	padding-top: 15rpx;
	box-sizing: border-box;
	font-size: 36rpx;
	font-family: PingFang SC;
	font-weight: 500;
	color: rgba(51, 51, 51, 1);
}
.bgc {
	// position: absolute;
	// top: calc(var(--status-bar-height));
	// left: 0rpx;
	width: 100%;
	height: 480rpx;
	display: block;
}
.header {
	// position: fixed;
	// top: 0;
	// left: 0;
	// background-image: url(../../static/header.png);
	height: 480rpx;
	width: 100%;
	.info-c {
		position: absolute;
		top: calc(var(--status-bar-height) + 44rpx + 70rpx);
		left: 30rpx;
		width: 690rpx;
		// background:rgba(255,255,255,1);
		// border-radius:20px;
		margin: 0 auto;
		z-index: 100;
	}
}
.info {
	// margin-top: calc(var(--status-bar-height) + 44rpx);
	display: flex;
	justify-content: flex-start;
	align-items: center;
	height: 100%;
	image {
		width: 120rpx;
		height: 120rpx;
		border-radius: 50%;
	}
	.right {
		margin-left: 24rpx;
		view {
			font-size: 40rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: rgba(51, 51, 51, 1);
		}
		.phone {
			font-size: 26rpx;
			font-weight: 500;
			margin-top: 29rpx;
		}
	}
}
.container {
	// background-color: #d9e6dc;
	min-height: calc(100vh - 430rpx);
	margin-top: 0rpx;
	// background:rgba(1,87,26,.08);

	// opacity:0.08;
	.container-c {
		width: 690rpx;
		margin: 0 auto;
		position: relative;
	}
	.order {
		position: absolute;
		left: 0;
		top: -140rpx;
		// height:230rpx;
		background: rgba(255, 255, 255, 1);
		border-radius: 20px;
		padding: 30rpx;
		box-sizing: border-box;
		width: 100%;
		.title {
			font-size: 18px;
			font-family: PingFang SC;
			font-weight: bold;
			color: rgba(51, 51, 51, 1);
		}
		.bottom {
			display: flex;
			justify-content: space-around;
			align-items: center;
			margin-top: 38rpx;
			.item {
				display: flex;
				justify-content: center;
				align-items: center;
				flex-direction: column;
				image {
					width: 65rpx;
					height: 65rpx;
				}
				view {
					font-size: 15px;
					font-family: PingFang SC;
					font-weight: 500;
					color: rgba(51, 51, 51, 1);
				}
			}
		}
	}
	.group {
		background: rgba(255, 255, 255, 1);
		padding: 0 30rpx;
		// padding-top: 0;
		box-sizing: border-box;
		width: 690rpx;
		position: absolute;
		left: 0;
		top: 140rpx;
		border-radius: 20px;
		.colmun {
			display: flex;
			justify-content: space-between;
			align-items: center;
			border-bottom: 1px solid rgba(0, 0, 0, 0.05);
			padding: 30rpx 0;
			box-sizing: border-box;
			.img {
				width: 39rpx;
				height: 39rpx;
			}
			view {
				flex: 1;
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-left: 28rpx;
				text {
					font-size: 30rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: rgba(102, 102, 102, 1);
				}
				.right {
					width: 13rpx;
					height: 23rpx;
				}
			}
		}
	}
}
.tip{
		// background: #DD524D;
		display: flex;
		align-items: center;
		flex-direction: column;
		justify-content: center;
		padding-bottom: 40rpx;
		font-size: 22rpx;
		color: #82848A;
	}

</style>
